Functional and connectivity changes in corticostriatal systems have been reported in the brains of patients with obsessive–compulsive disorder (OCD); however, the relationship between basal ganglia activity and OCD severity has never been adequately established. We recently showed that deep brain stimulation of the subthalamic nucleus (STN), a central basal ganglia nucleus, improves OCD. Here, single-unit subthalamic neuronal activity was analysed in 12 OCD patients, in relation to the severity of obsessions and compulsions and response to STN stimulation, and compared with that obtained in 12 patients with Parkinson's disease (PD). STN neurons in OCD patients had lower discharge frequency than those in PD patients, with a similar proportion of burst-type activity (69 vs 67%). Oscillatory activity was present in 46 and 68% of neurons in OCD and PD patients, respectively, predominantly in the low-frequency band (1–8 Hz). In OCD patients, the bursty and oscillatory subthalamic neuronal activity was mainly located in the associative–limbic part. Both OCD severity and clinical improvement following STN stimulation were related to the STN neuronal activity. In patients with the most severe OCD, STN neurons exhibited bursts with shorter duration and interburst interval, but higher intraburst frequency, and more oscillations in the low-frequency bands. In patients with best clinical outcome with STN stimulation, STN neurons displayed higher mean discharge, burst and intraburst frequencies, and lower interburst interval. These findings are consistent with the hypothesis of a dysfunction in the associative–limbic subdivision of the basal ganglia circuitry in OCD's pathophysiology.